package com.wxyzz.canteenadmin.canteencard.cardlist.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wxyzz.canteenadmin.canteencard.cardlist.mapper.CardListMapper;
import com.wxyzz.canteenadmin.canteencard.cardlist.param.CardListParam;
import com.wxyzz.canteenadmin.canteencard.cardlist.service.CardListService;
import com.wxyzz.canteencommon.entity.card.cardlist.CardList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author zhouhaoyu
 * @date 2024/10/9
 * @desc
 */
@Service
public class CardListServiceImpl implements CardListService {
    @Autowired
    private CardListMapper cardListMapper;

    @Override
    public PageInfo findAllAndPage(CardListParam cardListParam) {
        PageHelper.startPage(cardListParam.getPageNum(),cardListParam.getPageSize());
        List<CardList> cardList = cardListMapper.selectAllCardList(cardListParam);
        PageInfo<CardList> pageInfo = new PageInfo<CardList>(cardList);
        return pageInfo;
    }

    @Override
    public void delCardListById(Integer id) {
        cardListMapper.deleteCardListById(id);
    }

    @Override
    public void addCardList(CardList cardList) {
        cardListMapper.insertCardList(cardList);
    }

    @Override
    public void updateCardList(CardList cardList) {
        cardListMapper.updateCardList(cardList);
    }

    @Override
    public List<CardList> findAllCard() {
        return cardListMapper.selectAllCardList(null);
    }


}
